<?php
class AuthController extends Zend_Controller_Action
{
	/*
	 * Default action
	 */
	public function indexAction(){

		$form = new Ht_Form_Login();
        $request = $this->getRequest();
        if ($request->isPost()) {
            if ($form->isValid($request->getPost())) {
                $u = new Model_User();
            	if ($u->login($form->getValues())) {
                    //We're authenticated! Redirect to the home page
                    $this->_redirect("/".Zend_Registry::get('Zend_Locale')."/");
                }
            }
        }
        $this->view->form = $form;
		
	}
	public function logoutAction()
    {
        Zend_Auth::getInstance()->clearIdentity();
        $this->_forward('index'); // back to login page
    }

}